﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using iLangl.Model;

namespace iLangl
{
	public class Facade: IFacade
	{
		IFacade _facade;

		private static Facade instance;
		private static object mutex = new object();
		/// <summary>
		/// The instance of the Facade.
		/// </summary>
		public static Facade Instance
		{
			get
			{
				if (instance == null)
				{
					lock (mutex)
					{
						if (instance == null)
						{
							instance = new Facade();
						}
					}
				}
				return instance;
			}
		}
		

		public void Initialize(IFacade facade)
		{
			_facade = facade;
		}


		#region IFacade Members

		public Security.IAuthenticationService AuthenticationService
		{
			get
			{
				return _facade.AuthenticationService;
			}
			set
			{
				_facade.AuthenticationService = value;
			}
		}

		public Transport.Communication.IActionManager ActionManager
		{
			get
			{
				return _facade.ActionManager;
			}
			set
			{
				_facade.ActionManager = value;
			}
		}

		public Transport.Communication.ICommunicationManager CommunicationManager
		{
			get
			{
				return _facade.CommunicationManager;
			}
			set
			{
				_facade.CommunicationManager = value;
			}
		}

		public Transport.Communication.IPackageManager PackageManager
		{
			get
			{
				return _facade.PackageManager;
			}
			set
			{
				_facade.PackageManager = value;
			}
		}

		public StateMachine.IStateMachine StateMachine
		{
			get
			{
				return _facade.StateMachine;
			}
			set
			{
				_facade.StateMachine = value;
			}
		}

		public IModelFactory ModelFactory
		{
			get
			{
				return _facade.ModelFactory;
			}
			set
			{
				_facade.ModelFactory = value;
			}
		}
	

		public IAlertManager AlertManager
		{
			get
			{
				return _facade.AlertManager;
			}
			set
			{
				_facade.AlertManager = value;
			}
		}

		#endregion
	}
}
